﻿using System;
using System.Collections.Generic;


namespace NTTDATA.BEENChina.CaseMonitor.CaseChecker
{
    [Serializable]
    public abstract class Note
    {

        private int? DataCount
        {
            get;
            set;
        }

        public string TuneMi
        {
            get;
            set;
        }
        public String DateFrom
        {
            get;
            set;
        }
        public String DateTo
        {
            get;
            set;
        }
        
        public String Address
        {
            get;
            set;
        }

        public String DBName { get; set; }

        public String UserId { get; set; }

        public String PassWord { get; set; }

        public String Name 
        { 
            get;  
            set; 
        }


        public List<Note> NoteList
        {
            get;
            set;
        }

        public string CustomerID { get;   set; }

        

        public virtual int GetDataCount()
        {
            try
            {
                if (DataCount == null)
                {
                    DataCount = calcCount();
                }
            }
            catch (Exception ex)
            {
                
                Log.Console.Error("Note.GetDataCount()",ex);
            }

            

            return (int)DataCount;
        }
        
        protected abstract int calcCount();


        public int WorkState()
        {
            throw new NotImplementedException();
        }

        private bool IsConnect()
        {
            string ipAddress = this.Address;
            int splitIndex = Address.IndexOf('\\');
            if (splitIndex > 0)
            {
                ipAddress = ipAddress.Substring(0, splitIndex);
            }

            return  NetWork.NetWork.Ping(ipAddress);
        }

 
    }
}